home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Demos / Bowers Development / AppMaker 2.0b5 / Examples / ODF / AMSample / Sources / Select.cpp < prev    next >
Encoding:
Text File  |  1996-06-03  |  4.1 KB  |  154 lines  |  [TEXT/CWIE]

  1. //========================================================================================
  2. //
  3. //    File:                Select.cpp
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Copyright:            (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #include "AMSample.hpp"
  11.  
  12. #ifndef SELECT_H
  13. #include "Select.h"
  14. #endif
  15.  
  16. #ifndef CONTENT_H
  17. #include "Content.h"
  18. #endif
  19.  
  20. #ifndef PART_H
  21. #include "Part.h"
  22. #endif
  23.  
  24. #ifndef DEFINES_K
  25. #include "Defines.k"
  26. #endif
  27.  
  28. // ----- Framework Includes -----
  29.  
  30. #ifndef FWPRESEN_H
  31. #include "FWPresen.h"
  32. #endif
  33.  
  34. #ifndef FWUTIL_H
  35. #include "FWUtil.h"
  36. #endif
  37.  
  38. // ----- OS Includes -----
  39.  
  40. #ifndef FWBARRAY_H
  41. #include "FWBArray.h"
  42. #endif
  43.  
  44. // ----- Foundation Layer -----
  45.  
  46. #ifndef FWSUSINK_H
  47. #include "FWSUSink.h"
  48. #endif
  49.  
  50. #ifndef FWSTREAM_H
  51. #include "FWStream.h"
  52. #endif
  53.  
  54. #ifndef FWSTRING_H
  55. #include "FWString.h"
  56. #endif
  57.  
  58. // ----- OpenDoc Includes -----
  59.  
  60. #ifndef SOM_Module_OpenDoc_StdProps_defined
  61. #include <StdProps.xh>
  62. #endif
  63.  
  64. // ----- Macintosh Includes -----
  65.  
  66. #if defined(FW_BUILD_MAC) && !defined(__DRAG__)
  67. #include <Drag.h>
  68. #endif
  69.  
  70. //========================================================================================
  71. //    Runtime information
  72. //========================================================================================
  73.  
  74. #ifdef FW_BUILD_MAC
  75. #pragma segment AMSample
  76. #endif
  77.  
  78. FW_DEFINE_AUTO(CAMSampleSelection)
  79.  
  80. //========================================================================================
  81. //    Constants
  82. //========================================================================================
  83.  
  84. const ODPropertyName kAMSamplePropText = "AMSample:Property:Text";
  85.  
  86. //========================================================================================
  87. //    CLASS CAMSampleSelection
  88. //========================================================================================
  89.  
  90. //---------------------------------------------------------------------------------------
  91. //    CAMSampleSelection constructor
  92. //---------------------------------------------------------------------------------------
  93.  
  94. CAMSampleSelection::CAMSampleSelection(Environment* ev, CAMSampleContent* content) :
  95.     FW_CSelection(ev, false, false),
  96.     fAMSampleContent(content)
  97. {
  98. }
  99.  
  100. //---------------------------------------------------------------------------------------
  101. //    CAMSampleSelection destructor
  102. //---------------------------------------------------------------------------------------
  103.  
  104. CAMSampleSelection::~CAMSampleSelection()
  105. {
  106. }
  107.  
  108. //---------------------------------------------------------------------------------------
  109. //    CAMSampleSelection::GetSelectedContent
  110. //---------------------------------------------------------------------------------------
  111. //    The whole content is always selected
  112.  
  113. FW_CContent* CAMSampleSelection::GetSelectedContent(Environment* ev)
  114. {
  115.     return fAMSampleContent;
  116. }
  117.  
  118. //---------------------------------------------------------------------------------------
  119. //    CAMSampleSelection::ClearSelection
  120. //---------------------------------------------------------------------------------------
  121.  
  122. void CAMSampleSelection::ClearSelection(Environment* ev)
  123. {
  124.     fAMSampleContent->ClearTextData(ev);
  125. }
  126.  
  127. //---------------------------------------------------------------------------------------
  128. //    CAMSampleSelection::CloseSelection
  129. //---------------------------------------------------------------------------------------
  130.  
  131. void CAMSampleSelection::CloseSelection(Environment* ev)
  132. {
  133.     // Nothing to do
  134. }
  135.  
  136. //---------------------------------------------------------------------------------------
  137. //    CAMSampleSelection::IsEmpty
  138. //---------------------------------------------------------------------------------------
  139.  
  140. FW_Boolean CAMSampleSelection::IsEmpty(Environment* ev) const
  141. {
  142.     // Is the current string empty?
  143.     return (fAMSampleContent->GetTextData().GetByteLength() == 0);
  144. }
  145.  
  146. //---------------------------------------------------------------------------------------
  147. //    CAMSampleSelection::SelectAll
  148. //---------------------------------------------------------------------------------------
  149.  
  150. void CAMSampleSelection::SelectAll(Environment* ev)
  151. {
  152.     // Part's data is always "selected"
  153. }
  154.